<template>
	<view style="display: flex;flex:1;flex-direction: column;">
		<!-- <uni-nav-bar :fixed="true" background-color="#fff" status-bar left-icon="none" :height="50" :border="false">
			<view style="display: flex;flex: 1; align-items: center;justify-content: center;">
				<text
					style="display: flex; align-items: center;color: #303030; font-size: 32rpx;font-weight: 600;">文章</text>
			</view>
		</uni-nav-bar> -->
		<web-view :webview-styles="webviewStyles" update-title="false" :src="article.url"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: 0,
				article: {},
				webviewStyles: {
					// progress: false,
					progress: {
						color: '#FF3333'
					}
				},
			}
		},
		onLoad(option) {
			let articleJson = decodeURIComponent(option.article)
			console.log(articleJson);
			let art = JSON.parse(articleJson);
			art.url = art.url.replaceAll("http:", "https:");
			this.article = art;
		    this.share.title=art.title;
			this.share.path='/pages/article/article?article=' + encodeURIComponent(JSON.stringify(art));
			// WEB view 不支持分享到朋友圈 微信小程序分享功能
			uni.showShareMenu({
				withShareTicket:true,
				//小程序的原生菜单中显示分享按钮，才能够让发送给朋友与分享到朋友圈两个按钮可以点击
				menus: ["shareAppMessage", "shareTimeline"] //不设置默认发送给朋友
			})
		},
		methods: {
			back() {
				uni.navigateBack({
					delta: 1
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		width: 100%;
		height: 100% !important;
	}
</style>
